﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Manager_ManagerHome : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        if (Session["AdminUserID"] == null)
        {
            Response.Write("<script language=javascript>alert('Time is out.');window.open('../Default.aspx','_top');</script>");
            return;
        }   
     

    }
    
    private void CheckPage()
    {
        try
        {
            if (System.IO.Path.GetFileName(Request.ServerVariables["HTTP_REFERER"]).ToLower() != "default.aspx")
            {
                if (Request.QueryString["CodeID"] != null && Request.QueryString["CodeID"] != "")
                {
                    if (Request.QueryString["CodeID"] != "0" && Session["IsAdmin"].ToString() != "S" && Session["AutID"].ToString() != "0")
                    {
                        clsGetMenuAuth clsAuth = new clsGetMenuAuth(Session["AdminUserID"].ToString(), Session["AutID"].ToString(), Session["IsAdmin"].ToString(), Request.QueryString["CodeID"]);
                        if (clsAuth.IsShowAuth() == false)
                            Response.Redirect("~/Manager/default.aspx");
                    }
                    else if (Request.QueryString["CodeID"] != "-1" && Session["IsAdmin"].ToString() != "S" && Session["AutID"].ToString() == "0")
                    {
                        Response.Redirect("~/Manager/default.aspx");
                    }
                }
            }
        }
        catch
        {
            Response.Redirect("~/Manager/default.aspx");
        }
    }



    protected void Page_Init(Object sender, EventArgs e)
    {
        if (Session["AdminUserID"] == null)
            Response.Redirect("~/Manager/default.aspx");
    }
}
